package com.longjianghuasheng.logistics.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.databinding.ViewDataBinding
import com.longjianghuasheng.logistics.R
import com.zackratos.ultimatebarx.ultimatebarx.addStatusBarTopPadding

//带顶部search，和多状态布局
abstract class BaseSearchFragment<VM : BaseMultiStateViewModel, DB : ViewDataBinding> :
    BaseMultiStateFragment<VM, DB>() {

    lateinit var ivMenu: ImageView
    lateinit var ivSearch: ImageView
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        val flTop = view.findViewById<FrameLayout>(R.id.fl_top)
        val includeSearch =
            LayoutInflater.from(requireContext()).inflate(R.layout.include_search, flTop)
        with(includeSearch) {
            val clBg = findViewById<ConstraintLayout>(R.id.cl_bg)
            clBg.addStatusBarTopPadding()
            ivMenu = findViewById<ImageView>(R.id.iv_menu).apply {
                setOnClickListener {
                    onClassifyClick()
                }
            }
            ivSearch = findViewById<ImageView>(R.id.iv_search).apply {

                setOnClickListener {
//                    navigate(R.id.searchFragment)

                }
            }
        }
        super.onViewCreated(view, savedInstanceState)
    }

    open fun onClassifyClick() {

    }

}